#!/usr/bin/env node

const koa = require('koa');

const app = new koa();

app.use((ctx,next)=>{
  console.log(`${ctx.method} ${ctx.path}`)
  next();
})

app.use((ctx,next)=>{
  const start = Date.now();
  next();
  const end = Date.now();
  console.log(`cost:${end-start}ms`)
})
app.use((ctx,next)=>{
  ctx.body = 'hello koa2!';
})
app.listen(3000);
